Class MapBinaryHeap<T>
- java.lang.Object
-
- java.util.AbstractCollection<T>
-
- edu.claflin.finder.algo.edgebetweennessutils.MapBinaryHeap<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>,java.util.Queue<T>
public class MapBinaryHeap<T> extends java.util.AbstractCollection<T> implements java.util.Queue<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classMapBinaryHeap.ComparableComparator
-
Constructor Summary
Constructors Constructor Description MapBinaryHeap()MapBinaryHeap(java.util.Collection<T> c)MapBinaryHeap(java.util.Collection<T> c, java.util.Comparator<T> comp)MapBinaryHeap(java.util.Comparator<T> comp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T o)voidclear()booleancontains(java.lang.Object o)Telement()private voidinitialize(java.util.Comparator<T> comp)booleanisEmpty()java.util.Iterator<T>iterator()private intlChild(int i)booleanoffer(T o)private intparent(int i)Tpeek()private voidpercolateDown(int cur)private intpercolateUp(int cur, T o)Tpoll()private intrChild(int i)Tremove()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()private voidswap(int i, int j)voidupdate(T o)-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
heap
private java.util.Vector<T> heap
-
object_indices
private java.util.Map<T,java.lang.Integer> object_indices
-
comp
private java.util.Comparator<T> comp
-
TOP
private static final int TOP
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
private void initialize(java.util.Comparator<T> comp)
-
clear
public void clear()
-
add
public boolean add(T o)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
update
public void update(T o)
-
contains
public boolean contains(java.lang.Object o)
-
percolateDown
private void percolateDown(int cur)
-
percolateUp
private int percolateUp(int cur, T o)
-
lChild
private int lChild(int i)
-
rChild
private int rChild(int i)
-
parent
private int parent(int i)
-
swap
private void swap(int i, int j)
-
iterator
public java.util.Iterator<T> iterator()
-
remove
public boolean remove(java.lang.Object o)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
element
public T element() throws java.util.NoSuchElementException
- Specified by:
elementin interfacejava.util.Queue<T>- Throws:
java.util.NoSuchElementException
-
-